<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<meta name="description" content="AWStats Documentation - Security page">
<meta name="keywords" content="awstats, awstat, security, tips">
<meta name="robots" content="index,follow">
<meta name="title" content="AWStats Documentation - Security page">
<title>AWStats Documentation - Security page</title>
<link rel="stylesheet" href="styles.css" type="text/css">
<!-- $Revision: 1.42 $ - $Author: eldy $ - $Date: 2012/10/17 09:57:41 $ -->
</head>

<body topmargin=10 leftmargin=5>


<table style="font: 10pt arial,helvetica,verdana" cellpadding=0 cellspacing=0 border=0 bgcolor=#FFFFFF width=100%>

<!-- Large -->
<tr style="font: 10pt arial,helvetica,verdana">
<td bgcolor=#9999cc align=center><a href="/"><img src="images/awstats_logo4.png" border=0></a></td>
<td bgcolor=#9999cc align=center>
<br>
<font style="font: 16pt arial,helvetica,sans-serif" color=#EEEEFF><b>AWStats logfile analyzer 7.1 Documentation</b></font><br>
<br>
</td>
<td bgcolor=#9999cc align=center>
&nbsp;
</td>
</tr>

</table>


<br><br><H1 style="font: 26px arial,helvetica,sans-serif">Little Tips about Security</H1>

<br>
A lot of AWStats users have several web site to manage. This is particularly true for web hosting providers.
The most common things you would like to do is to prevent user xxx (having a site www.xxx.com) to see
statistics of user yyy (having a site www.yyy.com).<br>
<br><br>
This is example of possible way of working:<br>
<br><br>

<br><a name="1"><H2 style="font: 22px arial,helvetica,sans-serif color: #606060"><u>1) HIGHLY SECURED POLICY</u></H2></a><br>
<font color=blue><b>Policy</b></font>:<br>
You have several different config/domains owned by different users and you want to build statistics for each
of them. You don't need that your customer have "real-time" statistics.<br>
This is a very good choice for web hosting providers with few but very large web sites of important customers.<br>
<font color=blue><b>Advantage</b></font>:<br>
Very highly secured.<br>
<font color=blue><b>Disadvantage</b></font>:<br>
Statistics are static, no dynamic update/view.<br>
<font color=blue><b>How</b></font>:<br>
All statistics pages for a config/domain file are built in static html files using <b>-output -staticlinks</b> option.<br>
There is no CGI use of AWStats and static built pages are stored in a web protected <b>realm</b> to
be securely viewed by correct allowed users only (or sent by mails).<br>
If users have a command line access (telnet) on statistics server, you must set correct permissions on AWStats
database files. Set all AWStats database files (built by the update process) for config/domain1 to have read/write
for <i>user1</i> (or an admin user) and NO read and NO write permissions for any other users.<br>
Then, check that the <a href="awstats_config.html#SaveDatabaseFilesWithPermissionsForEveryone">SaveDatabaseFilesWithPermissionsForEveryone</a> parameter is set 0 in your config/domain files.<br>
If AWStats database files/directory for config/domain1 are read protected, only allowed users can see statistics for config/domain1.<br>
If AWStats database files/directory for config/domain1 are write protected, only allowed users can update statistics for config/domain1.<br>
<br><br>

<br><a name="2"><H2 style="font: 22px arial,helvetica,sans-serif color: #606060"><u>2) MEDIUM SECURED POLICY</u></H2></a><br>
<font color=blue><b>Policy</b></font>:<br>
You have several config/domain and several users. You want to specify which user can see or update dynamically
statistics for each config/domain.<br>
This is one of the most popular way of working.<br>
<font color=blue><b>Advantage</b></font>:<br>
Statistics are dynamic. High level of manageability.<br>
<font color=blue><b>Disadvantage</b></font>:<br>
AWStats database files must still be readable by anonymous web server user, so if an experienced user can have an access to
the server (telnet) where AWStats database files are stored, he can succeed in installing and running a "hacked" version
of AWStats that ignores value of parameter AllowAccessFromWebToAuthenticatedUsersOnly.<br>
<font color=blue><b>How</b></font>:<br>
awstats.pl file must be saved in a web protected <b>realm</b> to force a visitor to enter its username/password
to access AWStats CGI program.<br>
<br>
<u>Example of directives you can add into Apache to have awstats.pl in a web protected realm:</u><br>
<i>
&lt;Files "awstats.pl"&gt;<br>
AuthUserFile /path/to/.passwd<br>
AuthGroupFile /path/to/.group<br>
AuthName "Restricted Area For Customers"<br>
AuthType Basic<br>
require valid-user<br>
&lt;/Files&gt;
</i><br>
If you add such directives into a .htaccess file, you must also check that the <i>AllowOverride</i> directive is set
to <i>All</i> in Apache config file to allow the use of .htaccess files.<br>
<br>
To known how to create a protected realm for servers other than Apache, see your web server manual.<br>
<br>
Then edit each config/domain file you want to be protected to set <a href="awstats_config.html#AllowAccessFromWebToAuthenticatedUsersOnly">AllowAccessFromWebToAuthenticatedUsersOnly</a> to 1.<br>
You can also edit list of authorized users in the <a href="awstats_config.html#AllowAccessFromWebToFollowingAuthenticatedUsers">AllowAccessFromWebToFollowingAuthenticatedUsers</a> parameter.<br>
You can also specify a range of allowed browsers IP Addresses with the <a href="awstats_config.html#AllowAccessFromWebToFollowingIPAddresses">AllowAccessFromWebToFollowingIPAddresses</a> parameter.<br>

You can also set <a href="awstats_config.html#SaveDatabaseFilesWithPermissionsForEveryone">SaveDatabaseFilesWithPermissionsForEveryone</a> parameter to 0 in all config/domain files,
except if you want to allow update from web with option <a href="awstats_config.html#AllowToUpdateStatsFromBrowser">AllowToUpdateStatsFromBrowser</a>=1. But this is
not recommanded as you need to give read/write permission for Web server user on all history
files (Except if you setuid AWStats script for each authorized user, but this make setup much harder).<br>
The following parameters <a href="awstats_config.html#ErrorMessages">ErrorMessages</a> and <a href="awstats_config.html#DebugMessages">DebugMessages</a> are
also parameters related to security.<br>
<br>
<br>
Other tip: If the <b>AWSTATS_FORCE_CONFIG</b> environment variable is defined, AWStats will always use
the config file <i>awstats.VALUE_OF_AWSTATS_FORCE_CONFIG.conf</i> as the config/domain file.
So if you add this environment variable into your web server environment, for example by adding the line<br>
<i>SetEnv AWSTATS_FORCE_CONFIG configvalueforthisdomain</i><br>
in your Apache <i>&lt;VirtualHost&gt;</i> directive group in httpd.conf (with other directives), AWStats will use the config file
called <i>awstats.configvalueforthisdomain.conf</i> to choose which statistics used,
even if a visitor try to force the config/domain file with the URL '<i>http://mydomain/cgi-bin/awstats.pl?config=otherdomain</i>'.
This might be usefull for thoose who edit their config/domain file with <a href="awstats_config.html#AllowAccessFromWebToFollowingAuthenticatedUsers">AllowAccessFromWebToFollowingAuthenticatedUsers</a>="__REMOTE_USER__"</i>
instead of maintaining the list of authorized users into each AWStats config file.<br>
<br>
<br>


<br><a name="3"><H2 style="font: 22px arial,helvetica,sans-serif color: #606060"><u>3) NO SECURITY POLICY</u></H2></a><br>
<font color=blue><b>Policy</b></font>:<br>
You have only one hosts or several hosts or users but you don't need to manage particular permissions
for your different config/domain statistics.<br>
<font color=blue><b>Advantage</b></font>:<br>
Setup is very easy (No need of particular setup). Statistics are dynamic.<br>
<font color=blue><b>Disadvantage</b></font>:<br>
No way to prevent stats for config/domain to be seen by a user that known the
config/domain name and the url syntax to see stats of a particular config/domain.<br>
<font color=blue><b>How</b></font>:<br>
No particular things to do (You can however easily use <a href="awstats_config.html#AllowAccessFromWebToFollowingIPAddresses">AllowAccessFromWebToFollowingIPAddresses</a> parameter
to have a minimum of security).<br>
<br>
<br>
<br>

There is a lot of possible use for AWStats combining all its options/parameters with all web servers options/parameters and operating
systems security features. Just use the one you need...<br>
<br>


<br>
<hr>

<script language=javascript>
	var date='$Date: 2012/10/17 09:57:41 $';
	document.writeln("Last revision: "+date);
</script>

</body>
</html>
